package com.kinghunt.misp.common.enums.projectx;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 项目状态枚举
 */
public enum ProjectStatusEnum {
    default_type(1, "");

    @Getter
    private final Integer type;
    @Getter
    private final String desc;

    ProjectStatusEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    private final static Map<Integer, ProjectStatusEnum> map = new HashMap<>(8);
    static {
        for (ProjectStatusEnum e : ProjectStatusEnum.values()) {
            map.put(e.getType(), e);
        }
    }

    public static ProjectStatusEnum getByType(Integer type) {
        if (Objects.isNull(type)) {
            return null;
        }
        return map.get(type);
    }
}
